// 说明： 提取导航菜单功能
/* 表格和图片的锚点列表 */
$("body").prepend('<div id="DmMedialistDiv" style="display:none;">'
    + '<div class="DmMedialist_div"><div class="DmMedialist_div_titlle">' + i18n("i18n-lan-navigation") + '</div>'
    + '<ul id="DmMedialist" class="layui-timeline"></ul></div></div>');

/* 为每个节点添加id */
var element = [];
element = $("body").find("*");
for (var i = 0; i < element.length; i++) {
    //表格多媒体列表
    // addList($(element[i]));
}
//显示锚点列表--base.js
// addListShow();

//导航-标题
$(".dmMediaLi-title").on("click",function() {
    restDefaultNav();
    //定位，base.js
    getTitlePosition($(this).text());
    $(this).children(".circle").css("backgroundColor","rgba(255, 222, 35, 0.89)");
    $(this).children("a").removeClass("dmMediaLi-title-a");
    $(this).children("a").addClass("dmMediaLi-title-a-click");
});

//导航-图
$(".dmMediaLi-figure").on("click",function() {
    restDefaultNav();
    //定位，base.js
    getFigurePosition($(this).text());
    $(this).children(".circle").css("backgroundColor","rgba(255, 222, 35, 0.89)");
    $(this).children("a").removeClass("dmMediaLi-figure-a");
    $(this).children("a").addClass("dmMediaLi-figure-a-click");

});

//导航-表
$(".dmMediaLi-table").on("click",function() {
    restDefaultNav();
    //定位，base.js
    getTablePosition($(this).text());
    $(this).children(".circle").css("backgroundColor","rgba(255, 222, 35, 0.89)");
    $(this).children("a").removeClass("dmMediaLi-table-a");
    $(this).children("a").addClass("dmMediaLi-table-a-click");

});

//恢复全部导航默认样式
function restDefaultNav(){
    $(".dmMediaLi-title").children("a").removeClass("dmMediaLi-title-a-click");
    $(".dmMediaLi-title").children("a").addClass("dmMediaLi-title-a");
    $(".dmMediaLi-title").children(".circle").css("backgroundColor","");

    $(".dmMediaLi-figure").children("a").removeClass("dmMediaLi-figure-a-click");
    $(".dmMediaLi-figure").children("a").addClass("dmMediaLi-figure-a");
    $(".dmMediaLi-figure").children(".circle").css("backgroundColor","");

    $(".dmMediaLi-table").children("a").removeClass("dmMediaLi-table-a-click");
    $(".dmMediaLi-table").children("a").addClass("dmMediaLi-table-a");
    $(".dmMediaLi-table").children(".circle").css("backgroundColor","");
}
